//
//  DDSoundTableViewCell.m
//  ialone
//
//  Created by lanou on 16/1/12.
//  Copyright © 2016年 KFC. All rights reserved.
//

#import "DDSoundTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation DDSoundTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview];
    }
    return self;
}

- (void)addSubview
{
    
    self.thumbnail = [[UIImageView alloc]initWithFrame:CGRectMake(20, 20, kScreenWidth * 0.3, 80)];
    self.thumbnail.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.thumbnail];
    
    
    self.titleLable = [[UILabel alloc]initWithFrame:CGRectMake(self.thumbnail.right+20, self.thumbnail.frame.origin.y, kScreenWidth * 0.3, 50)];
    self.titleLable.numberOfLines = -1;
    [self.contentView addSubview:self.titleLable];
    
    
    self.author = [[UILabel alloc]initWithFrame:CGRectMake(self.thumbnail.right+20, self.thumbnail.frame.origin.y + 60,100, 20)];
    self.author.font = [UIFont systemFontOfSize:15];
    self.author.textColor = [UIColor colorWithRed:163/255.0 green:162/255.0 blue:159/255.0 alpha:1];
    [self.contentView addSubview:self.author];
    
    
    self.jumpImage = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenWidth - 40*kWidthBase, (120-35) / 2 * kHeightBase, 30*kWidthBase, 35*kHeightBase)];
    self.jumpImage.image = [UIImage imageNamed:@"goin_button@2x"];
    //self.jumpImage.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.jumpImage];
    
}

- (void)setModel:(DDSoundModel *)model
{
    _model = model;
    [self.thumbnail sd_setImageWithURL:[NSURL URLWithString:model.thumbnail] placeholderImage:[UIImage imageNamed:@"messages_tableview_background@2x"]];
    self.author.text = model.author;
    self.titleLable.text = model.title;
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
